<div ng-controller='Forms.FormTestController'>

  <div class="row-fluid">
    <h3>Basic form</h3>
    <p>Here's a basic form generated from some JSON schema</p>

    <p>Here's some example JSON schema definition</p>
    <div hawtio-editor="basicFormEx1Schema" mode="javascript"></div>
    <button class='btn' ng-click="updateSchema()"><i class="icon-save"></i> Update form</button>

    <p>You can define an entity object to have default values filled in</p>
    <div hawtio-editor="basicFormEx1EntityString" mode="javascript"></div>
    <button class='btn' ng-click="updateEntity()"><i class="icon-save"></i> Update form</button>

    <p>And here is the code for the form</p>
    <div hawtio-editor="basicFormEx1" mode="html"></div>

    <p>The resulting form</p>
    <div class="directive-example">
      <div compile="basicFormEx1"></div>
    </div>

    <h3>Form related controls</h3>
    <p>There's also directives to take care of resetting or submitting a form</p>

    <p></p>
    <p>Clearing a form is done using the hawtio-reset directive</p>
    <div hawtio-editor="hawtioResetEx" mode="html"></div>
    <p>Click the button below to clear the above form</p>
    <div class="directive-example">
      <div compile="hawtioResetEx"></div>
    </div>

    <p>And to submit a form use hawtio-submit</p>

    <div hawtio-editor="hawtioSubmitEx" mode="html"></div>
    <div class="directive-example">
      <div compile="hawtioSubmitEx"></div>
    </div>

    <p>Fill in the form and click the submit button above to see what the form produces</p>
    <div hawtio-editor="basicFormEx1Result" mode="javascript"></div>
    <p></p>
    <p></p>
    <p></p>
    <p></p>
  </div>

  <!--

  <h3>Form Testing</h3>

  <div>
    <div class="control-group">
      <a class='btn' ng-href="" hawtio-submit='form-with-inline-arguments'><i class="icon-save"></i> Save</a>
      <a class='btn' ng-href="" hawtio-reset='form-with-inline-arguments'><i class="icon-refresh"></i> Clear</a>
    </div>
    Form with inline arguments
    <div simple-form name='form-with-inline-arguments' action='#/forms/test' method='post' data='setVMOption' entity='cheese' onSubmit="derp()"></div>
  </div>

  <hr>

  <div>
    Read Only Form with config object
    <div class="row-fluid">
      <button class="btn" ng-click="toggleEdit()">Edit</button>
    </div>
    <div simple-form data='setVMOption' entity='cheese' mode='view'></div>
  </div>

  <hr>

  <div>
    Form with config object
    <div simple-form='config'></div>
  </div>

  <hr>

  <div>
    form with inline json config
    <div simple-form name='form-with-inline-json-config' action='#/forms/test' method='post' showTypes='false' json='
    {
      "properties": {
        "key": { "description": "Argument key", "type": "java.lang.String" },
        "value": { "description": "Argument value", "type": "java.lang.String" },
        "longArg": { "description": "Long argument", "type": "Long" },
        "intArg": { "description": "Int argument", "type": "Integer" }},
       "description": "Show some stuff in a form from JSON",
       "type": "java.lang.String"
    }'></div>
  </div>

  -->
</div>
